package cn.itcast.travel.web.servlet.blogtype;

import cn.itcast.travel.domain.blogtype;
import cn.itcast.travel.service.BlogtypeService;
import cn.itcast.travel.service.impl.BlogtypeServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "Blogtype", value = "/Blogtype")
public class Blogtype extends HttpServlet {
    BlogtypeService service=new BlogtypeServiceImpl();
    //获取博客类别
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ObjectMapper ob=new ObjectMapper();
        List<blogtype> bt=service.getalltype();
        ob.writeValue(response.getWriter(),bt);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
